Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(radio): radio button flex-shrink problem #636

Merged
merged 1 commit into from
Jun 28, 2023

Conversation

doganozturk
Copy link
Contributor

I've noticed an issue with the bl-radio component where the radio button's size shrinks if the text within the #label element becomes too long. The #label element is a flex container, its :before pseudo-selector, which is used to create the radio button, is designed with strict width and height settings, leading to this behavior.

The cause of the radio button shrinking is tied to its flex-shrink property. However, applying flex-shrink: 0; to address this issue would be overly specific.

As a solution, I've implemented a flex: none; setting which prevents the radio button from shrinking.

I'm attaching a few example screenshots to illustrate the issue:

246438482-cfee32d8-0a4d-4ddc-83c0-a3277cb34112 246438494-06740896-5d8e-44d7-a166-7ea6b3c36d32

@muratcorlu
Copy link
Contributor

muratcorlu commented Jun 19, 2023

Thanks for the PR and very good explanation! 😊

We had similar issue with checkbox component and fixed it by setting min/max width/height for it. Can we have some side effects of disabling flex layout for radio in terms of vertical alignment or gap between label and it etc?

@doganozturk
Copy link
Contributor Author

doganozturk commented Jun 19, 2023

Thanks for the PR and very good explanation! 😊

We had similar issue with checkbox component and fixed it by setting min/max width/height for it. Can we have some side effects of disabling flex layout for radio in terms of vertical alignment or gap between label and it etc?

Same effect can be achieved via min/max width/height as it seems. I can update my PR according to that solution. Would it be more suitable?

#label::before {
  content: '';
  display: inline-block;
  box-sizing: border-box;
  min-width: var(--size);
  min-height: var(--size);
  max-width: var(--size);
  max-height: var(--size);
  ...
}

@muratcorlu
Copy link
Contributor

I'm not completely sure as well but even if there is no difference, to be aligned with other components, that would be better, I believe. Thanks!

@doganozturk doganozturk force-pushed the fix/radio-button-shrinking branch 2 times, most recently from 9ec0a82 to eaa0535 Compare June 19, 2023 11:36
@muratcorlu muratcorlu merged commit 32a7104 into Trendyol:next Jun 28, 2023
@doganozturk doganozturk deleted the fix/radio-button-shrinking branch June 28, 2023 09:17
@muratcorlu muratcorlu mentioned this pull request Jul 14, 2023
@github-actions
Copy link

🎉 This PR is included in version 2.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants